/*Viet chuong trinh, doc vao 1 so nguyen duong n (1 <= n <= 5)
*in ra cac chu so theo thu tu tang dan
*/

#include <math.h>

int length(int Num){
	if(Num <= 10) return 1;
	else return 1+length(Num/10);
}
void arrangeNum(int &N){
	int len = 0;
	int tem = N;
	len = length(tem);
	int* p = new int[len];
	for(int i = 0; i < len; i++){
		p[i] = tem%10;
		tem = tem/10;
	}
	for(int i = 0; i < len-1; i++)
		for(int j = i+1; j < len; j++){
			if(p[i] < p[j]){
				int t = p[i];
				p[i] = p[j];
				p[j] = t;
			}
		}
	N = 0;
	for(int i = len-1; i >= 0; i--){
		N += p[i]*(int)pow(10,i);
	}
	delete p;
}